1. Field of the Invention
The present invention relates to image processing apparatus and program for correcting an image shake in a moving image.
2. Related Art
An image shake preventing apparatus is hitherto known which detects an image shake due to camera shake with an image sensor such as a CCD or a CMOS and corrects the image shake (for example, see Unexamined Japanese Patent Publication 2004-15376). This apparatus calculates a range of magnitudes of motion vectors to be selected in respective areas, which compose each of image frames which in turn compose a captured image, based on the average value and standard deviation of the motion vectors and selects only motion vectors present in the selected range of magnitudes. Furthermore, the apparatus calculates a contrast coefficient for motion vectors in each area, a weighing coefficient based on the contrast coefficient, and an average of the motion vectors weighted with the weighting coefficient in each area, which is used as a total motion vector in that area. Thus, the reliability of the total motion vector is evaluated and the total motion vector can be calculated appropriately.
However, since in this apparatus it is determined whether or not the calculated motion vectors are appropriate for calculating the total motion vector, the motion vectors of a subject image inappropriate for calculating the total motion vector will also be calculated necessarily. Thus, the efficiency of the image shake correction is low.
We can use a method of calculating motion vectors of macroblocks of a frame estimated to be appropriate for calculating a total motion vector as a result of analysis of the distinctive attributes of a subject and then calculating a total motion vector based on the motion vectors of the macroblocks. This method is improved in prevention of needless vector calculation. Since in this method analysis of the subject, or determination of whether or not each macroblock is appropriate for calculating the total motion vector, is still required as a prestep, it is difficult to reduce the series of processing times greatly.
For example, as shown in FIGS. 7 and 8, a conventional image capture apparatus 200 comprises an image capturer 201 that captures a moving image and converts the image to electronic image data, a feature detector 202 that detects the features of an image based on the image data and calculates the amount of the features, a block selector 203 that selects a block appropriate for calculating a displacement of the frame, a motion calculator 204 that calculates a motion vector from each of the selected blocks, a displacement corrector 205 that corrects the displacement of that frame based on the calculated motion vectors, an encoder 206 that encodes resulting corrected image data, and a display 207 that displays a resulting captured moving image.
In the image capture apparatus 200, in order to ensure a predetermined frame rate when a moving image is captured, a series of processing steps such as amount-of-features calculation, block selection, moving vector calculation and displacement correction, ranging from the exposing step to the encoding and displaying steps (steps A1-A6), must be performed in a predetermined time (see FIG. 8). However, if such series of processing steps are performed sequentially, a considerable processing time is required from determination of an offset in one frame to clipping of predetermined image data. Thus, there is the problem with this apparatus that the drive frequency of a CPU concerned must be increased and that a working memory must be provided additionally.